import fetch from '@/utils/fetch';

export function list(parentCode) {
  return fetch({
    url: '/api/admin/menu/list?parentCode=' + parentCode,
    method: 'GET',
  });
}

export function get(uid) {
  return fetch({
    url: '/api/admin/menu/' + uid,
    method: 'get'
  })
}

export function add(obj) {
  return fetch({
    url: '/api/admin/menu/addMenu',
    method: 'POST',
    data: obj
  });
}

export function edit(obj) {
  return fetch({
    url: '/api/admin/menu/' + obj.uid,
    method: 'put',
    data: obj
  })
}

export function del(code) {
  return fetch({
    url: '/api/admin/menu/del/' + code,
    method: 'delete'
  })
}
